#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const int N = 2e5 + 10;
int n, q, a[N];

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    cin >> n >> q;
    map<int, vector<int>> m;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        m[a[i]].push_back(i);
    }

    while(q--) {
        int x, y;
        cin >> x >> y;
        if (m[x].size() == 0) {
            cout << -1 << endl;
            continue;
        } else {
            if (m[x].size() < y) {
                cout << -1 << endl;
                continue;
            } else {
                cout << m[x][y-1] << endl;
            }
        }
    }
    
    return 0;
}